<template>
  <div class="outputDaily">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">已发货订单产品数量</span>
      </div>
      <s-table
        :table="table"
        @http="tableWatch">
        <el-form-item label="状态查询" prop="gg">
          <!--筛选条件-->
          <el-select  class="input"
                     v-model="autoVue_table_zt"
                     placeholder="请选择"
                     auto-complete="off"
                     auto-correct="off">
              <el-option label="全部" value="0" >
              </el-option>
              <el-option label="已发货订单" value="1">
              </el-option>
              <el-option label="待发货订单" value="2">
              </el-option>
          </el-select>
        </el-form-item>
        <!--根据时间-->
        <el-form-item label="创建时间" prop="cjsj">
          <el-date-picker
            type="daterange"
            v-model="autoVue_table_cjsj"
            placeholder="选择日期范围">
          </el-date-picker>
        </el-form-item>
        <!--多选导出-->
        <el-form-item slot="multiSelect" label="多选操作" prop="multiSelect" v-if="table.multiSelect">
          <el-row>
            <el-col :span="8">
              <el-button size="small" type="info" @click="tableExport('')">多选导出</el-button>
            </el-col>
          </el-row>
        </el-form-item>
      </s-table>
    </el-card>
  </div>
</template>

<script>
  import {AutoVue} from '~/plugins/Tools';
  // function _from1 () {
  //   return {
  //     zt:
  //       { value: '0',
  //         rule: [ 'vNull' ],
  //         cRemarks: '全部订单 1已发货 2待发货' },
  //   };
  // };
  // function _formEdit () {
  //   return {
  //     zt:
  //       { value: '0',
  //         rule: [ 'vNull' ],
  //         cRemarks: '全部订单 1已发货 2待发货' },
  //   };
  // };
  export default AutoVue({
    name: 'journaling_outputDaily-FEcarWms',
    head: {
      'title': '已发货订单产品数量',
      'meta': [
        { 'hid': 'description', 'name': 'description', 'content': '乐速科技平台 出库日报 查看进出库日报信息' },
      ],
    },
    store: ['USER'],
    data: {
      table: {
        column: [
          { label: '规格',
            prop: 'gg',
            minWidth: '0px',
            search: true },
          { label: 'NC编码',
            prop: 'nc',
            minWidth: '100px',
            cRemarks: '',
            search: false },
          { label: '产品编码',
            prop: 'bh',
            minWidth: '100px',
            cRemarks: '',
            search: false },
          { label: '货品名称',
            prop: 'hpmc',
            minWidth: '200px',
            cRemarks: '',
            search: true },
          { label: '单价',
            prop: 'dj',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '单位',
            prop: 'dw',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '总计',
            prop: 'total',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '北京市',
            prop: 'beijingshisl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '天津市',
            prop: 'tianjinshisl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '上海市',
            prop: 'shanghaishisl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '重庆市',
            prop: 'zhongqingshisl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '河北省',
            prop: 'hebeishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '山西省',
            prop: 'shanxishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '辽宁省',
            prop: 'liaoningshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '吉林省',
            prop: 'jilinshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '黑龙江省',
            prop: 'heilongjiangshengsl',
            minWidth: '100px',
            cRemarks: '',
            search: true },
          { label: '江苏省',
            prop: 'jiangsushengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '浙江省',
            prop: 'zhejiangshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '安徽省',
            prop: 'anhuishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '福建省',
            prop: 'fujianshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '江西省',
            prop: 'jiangxishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '山东省',
            prop: 'shandongshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '河南省',
            prop: 'henanshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '湖北省',
            prop: 'hubeishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '湖南省',
            prop: 'hunanshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '广东省',
            prop: 'guangdongshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '海南省',
            prop: 'hainanshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '四川省',
            prop: 'sichuanshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '贵州省',
            prop: 'guizhoushengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '云南省',
            prop: 'yunnanshengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '陕西省',
            prop: 'shanxisheng1sl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '甘肃省',
            prop: 'gansushengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '青海省',
            prop: 'qinghaishengsl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '台湾',
            prop: 'taiwansl',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '内蒙古自治区',
            prop: 'neimengguzizhiqusl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '广西壮族自治区',
            prop: 'guangxizhuangzuzizhiqusl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '西藏自治区',
            prop: 'xizangzizhiqusl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '宁夏回族自治区',
            prop: 'ningxiahuizuzizhiqusl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '新疆维吾尔自治区',
            prop: 'xinjiangweiwuerzizhiqusl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '香港',
            prop: 'xianggangsl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: '澳门',
            prop: 'aomensl',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: 'cjsj',
            prop: 'cjsj',
            type: 'DateRange',
            minWidth: '150px',
            cRemarks: '',
            search: true },
          { label: 'zt',
            prop: 'zt',
            minWidth: '150px',
            cRemarks: '',
            search: true },
        ],
        url: '/wmsorderreport/list',
        option: {
          page: 1,
          rows: 10,
        },
        key: 'id',
        tableColumn: 41,
      },
    },
    methods: {
      tableExport (row) {
        let tableRef = 'table';
        let ids = [];
        if (row) {
          ids.push(row.hpid);
        } else {
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.hpid);
          });
        }
        this.$confirm('您将导出已发货订单产品数量报表数据。', '确认导出？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              let option = Object.assign({}, this['autoVue_' + tableRef]);
              await this.p({
                url: '/wmsorderreport/getOutPutList',
                method: 'post',
                responseType: 'blob',
                data: {
                  ids,
                  ...option,
                },
              });
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
      // tableExport (row) {
      //   this.$confirm('您将导出订单量统计。', '确认导出？', {
      //     confirmButtonText: '是',
      //     cancelButtonText: '否',
      //     type: 'warning',
      //   })
      //     .then(async _ => {
      //       try {
      //         await this.p({
      //           url: '/wmsorderreport/getOutPutList',
      //           method: 'post',
      //           responseType: 'blob',
      //           data: {
      //             state: '0',
      //           },
      //         });
      //       } catch (err) {
      //         console.log(err);
      //       }
      //     })
      //     .catch(_ => {
      //     });
      // },
    },
    transition: 'slide-fade',
    mounted: function () {
      this.tableWatch('table');
    },
  });
</script>
<style scoped lang="scss">
  .box-card {
    margin: 20px;
  }

  .createTimeSpan {
    display: block;
    margin-top: 34px;
  }

  @media screen and (max-width: 800px) {
    .createTimeSpan {
      margin-top: 0;
    }
    .box-card {
      margin: 0;
    }
  }

  .el-select {
    width: 100%;
  }
</style>

<style lang="scss">

</style>
